*********************
*This file contains the code to generate results in
*TABLE 4 and summary stats in Table S4.1
*******************************
set more off

use "dataEP.dta", clear

*****************
*TABLE 4
*****************


qui xtreg NOMd1 c.lr_mean#c.logintensity  lr_mean  i.ep , i(cdID) fe rob
predict yhat if e(sample)
xtreg attendance logintensity i.ep if yhat !=., i(cdID) fe rob
xtreg shirking logintensity i.ep if yhat !=. , i(cdID) fe rob
xtreg NOMd1 c.lr_mean#c.logintensity  lr_mean  i.ep , i(cdID) fe rob



*Clustered SEs using wild bootstrap require Stata ado cgmwildboot (Petersen, Miller and Casey) and cpmreg (Miller)
*Manually create district and vote dummies
*qui tab cdID, gen(dummydist)
*gen ep4=1 if ep==4
*replace ep4=0 if ep==5
*gen lr_logintensity = lr_mean*logintensity
*To numerically replicate results, set seed to 999 and reps to 400
*For instance, code for model 1
*cgmwildboot attendance logintensity ep4 dummydist2-dummydist31 if yhat !=., cluster(cdID) bootcluster(cdID) seed(999) reps(400)


*********************
*Table S4.1
*********************

tabstat logintensity attendance shirking NOMd1 lr_mean, stat(mean sd min max) col(stat) format(%9.2f)
